<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The setFontFace purpose</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="cairocontext.setfillrule.html">CairoContext::setFillRule</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="cairocontext.setfontmatrix.html">CairoContext::setFontMatrix</a></div>
 <div class="up"><a href="class.cairocontext.html">CairoContext</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="cairocontext.setfontface" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">CairoContext::setFontFace</h1>
  <h1 class="refname">cairo_set_font_face</h1>
  <p class="verinfo">(PECL cairo &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">CairoContext::setFontFace</span> -- <span class="refname">cairo_set_font_face</span> &mdash; <span class="dc-title">The setFontFace purpose</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-cairocontext.setfontface-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格 (method):</p>
   <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>CairoContext::setFontFace</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.cairofontface.html" class="type CairoFontFace">CairoFontFace</a></span> <code class="parameter">$fontface</code></span>
    )</div>

  <p class="para rdfs-comment">过程化风格:</p>
  <div class="methodsynopsis dc-description">
   <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>cairo_set_font_face</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.cairocontext.html" class="type CairoContext">CairoContext</a></span> <code class="parameter">$context</code></span>
   , <span class="methodparam"><span class="type"><a href="class.cairofontface.html" class="type CairoFontFace">CairoFontFace</a></span> <code class="parameter">$fontface</code></span>
   )</div>

  <p class="para rdfs-comment">
  Sets the font-face for a given context.
  </p>
 
 </div>


 <div class="refsect1 parameters" id="refsect1-cairocontext.setfontface-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">context</code></em></dt>

     <dd>

      <p class="para">
       A CairoContext object to change the font-face for.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">fontface</code></em></dt>

     <dd>

      <p class="para">
       A CairoFontFace object
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-cairocontext.setfontface-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   No value is returned
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-cairocontext.setfontface-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2914">
    <p><strong>Example #1 面向对象风格</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;New&nbsp;surface&nbsp;with&nbsp;white&nbsp;background<br /></span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">CairoImageSurface</span><span style="color: #007700">(</span><span style="color: #0000BB">CairoFormat</span><span style="color: #007700">::</span><span style="color: #0000BB">ARGB32</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">300</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">CairoContext</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSourceRgb</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">paint</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;Draw&nbsp;some&nbsp;text<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSourceRgb</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">moveTo</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">60</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;Create&nbsp;a&nbsp;new&nbsp;font&nbsp;face<br /></span><span style="color: #0000BB">$f&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">CairoToyFontFace</span><span style="color: #007700">(</span><span style="color: #DD0000">"sans-serif"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CairoFontSlant</span><span style="color: #007700">::</span><span style="color: #0000BB">NORMAL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CairoFontWeight</span><span style="color: #007700">::</span><span style="color: #0000BB">NORMAL</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setFontFace</span><span style="color: #007700">(</span><span style="color: #0000BB">$f</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setFontSize</span><span style="color: #007700">(</span><span style="color: #0000BB">30</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showText</span><span style="color: #007700">(</span><span style="color: #DD0000">'Hello,&nbsp;World!'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">writeToPng</span><span style="color: #007700">(</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'/setFontFace.png'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2915">
    <p><strong>Example #2 过程化风格</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;...&nbsp;*/<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-cairocontext.setfontface-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="cairocontext.setfontsize.html" class="methodname" rel="rdfs-seeAlso">CairoContext::setFontSize()</a> - The setFontSize purpose</span></li>
    <li class="member"><span class="methodname"><a href="cairocontext.showtext.html" class="methodname" rel="rdfs-seeAlso">CairoContext::showText()</a> - The showText purpose</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="cairocontext.setfillrule.html">CairoContext::setFillRule</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="cairocontext.setfontmatrix.html">CairoContext::setFontMatrix</a></div>
 <div class="up"><a href="class.cairocontext.html">CairoContext</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
